#ifndef _HEADER_H
#define _HEADER_H 

#include <header.h>
#include <string>
using std::string;

class InetAddress
{
public:
    InetAddress(uint16_t port,string ip = "0.0.0.0") {
        _addr.sin_family = AF_INET;
        _addr.sin_port = htons(port);
        _addr.sin_addr.s_addr = inet_addr(ip.c_str()); 
    }

    string ip()const{return inet_ntoa(_addr.sin_addr);}
    uint16_t port()const{return ntohs(_addr.sin_port);}

    sockaddr * getSockAddr(){return (sockaddr *)(&_addr);}

    ~InetAddress() {}


private:
    sockaddr_in _addr;
};
#endif

